//
//  ViewController.m
//  11-HomeWork
//
//  Created by dllo on 16/7/28.
//  Copyright © 2016年 DM.C. All rights reserved.
//

#import "ViewController.h"
#import "RegisterViewController.h"
#import "ForgetPassWordViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UITextField *textFieldOfUser;
@property (weak, nonatomic) IBOutlet UITextField *textFieldOfPassWord;
@property (weak, nonatomic) IBOutlet UIButton *buttonOfUser;
@property (weak, nonatomic) IBOutlet UIButton *buttonOfPassWord;
@property (weak, nonatomic) IBOutlet UIButton *buttonOfLogon;
@property (weak, nonatomic) IBOutlet UIButton *buttonOfRegister;
@property (weak, nonatomic) IBOutlet UIImageView *backGroundImage;
@property (weak, nonatomic) IBOutlet UIButton *buttonOfForget;
@property (weak, nonatomic) IBOutlet UIView *viewOfButton;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
    self.navigationController.navigationBar.shadowImage = [UIImage new];
    self.navigationController.navigationBar.translucent = YES;

    [self.buttonOfRegister addTarget:self action:@selector(clickRegisterButton:) forControlEvents:UIControlEventTouchUpInside];
    [self.buttonOfForget addTarget:self action:@selector(clickForgetButton:) forControlEvents:UIControlEventTouchUpInside];
    _buttonOfRegister.layer.cornerRadius = 5;
    _buttonOfLogon.layer.cornerRadius = 5;
    _buttonOfRegister.layer.borderColor = [UIColor colorWithRed:0.00 green:0.68 blue:0.53 alpha:1.00].CGColor;
    _buttonOfRegister.layer.borderWidth = 2;
    _viewOfButton.layer.cornerRadius = 5;
    [self layerOfBezier];
    
}
// 创建贝塞尔曲线
- (void)layerOfBezier {
    UIBezierPath *userBezier = [UIBezierPath bezierPathWithRoundedRect:_textFieldOfUser.bounds byRoundingCorners:UIRectCornerTopRight cornerRadii:CGSizeMake(5, 5)];
    CAShapeLayer *userLayer = [[CAShapeLayer alloc] init];
    userLayer.frame = _textFieldOfUser.bounds;
    userLayer.path = userBezier.CGPath;
    _textFieldOfUser.layer.mask = userLayer;
    
    UIBezierPath *passWordBezier = [UIBezierPath bezierPathWithRoundedRect:_textFieldOfPassWord.bounds byRoundingCorners:UIRectCornerBottomRight cornerRadii:CGSizeMake(5, 5)];
    CAShapeLayer *passWordLayer = [[CAShapeLayer alloc] init];
    passWordLayer.frame = _textFieldOfPassWord.bounds;
    passWordLayer.path = passWordBezier.CGPath;
    _textFieldOfPassWord.layer.mask = passWordLayer;
    
    UIBezierPath *userButtonBezier = [UIBezierPath bezierPathWithRoundedRect:_buttonOfUser.bounds byRoundingCorners:UIRectCornerTopLeft cornerRadii:CGSizeMake(5, 5)];
    CAShapeLayer *userButtonLayer = [[CAShapeLayer alloc] init];
    userButtonLayer.frame = _buttonOfUser.bounds;
    userButtonLayer.path = userButtonBezier.CGPath;
    _buttonOfUser.layer.mask = userButtonLayer;
    
    UIBezierPath *passWordButtonBezier = [UIBezierPath bezierPathWithRoundedRect:_buttonOfPassWord.bounds byRoundingCorners:UIRectCornerBottomLeft cornerRadii:CGSizeMake(5, 5)];
    CAShapeLayer *passWordButtonLayer = [[CAShapeLayer alloc] init];
    passWordButtonLayer.frame = _buttonOfPassWord.bounds;
    passWordButtonLayer.path = passWordButtonBezier.CGPath;
    _buttonOfPassWord.layer.mask = passWordButtonLayer;

}
// 实现点击方法
- (void)clickRegisterButton:(UIButton *)button {
    RegisterViewController *registerVC = [[RegisterViewController alloc] initWithNibName:@"RegisterViewController" bundle:[NSBundle mainBundle]];
    [self.navigationController pushViewController:registerVC animated:YES];
}
- (void)clickForgetButton:(UIButton *)button {
    ForgetPassWordViewController *forget = [[ForgetPassWordViewController alloc] initWithNibName:@"ForgetPassWordViewController" bundle:nil];
    [self.navigationController pushViewController:forget animated:YES];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
